<template>
  <div>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const { currentRoute } = useRouter();
const router = useRouter();
import { getUserInfoApi } from '../utils/api.js'
// router.push({ path: '/humans' }
const getId = async (token) => {
  // window.sessionStorage.setItem('username', "15701160854");
  // window.sessionStorage.setItem('manageSite', "a62c04302e4d4e5682b75b4e03fd4238");
  // window.sessionStorage.setItem('areaId', "0000011");
  // router.push({ path: '/Mapmoti' });

  let res = await getUserInfoApi(token)
  console.log(res);
  if (res.data.code == 200) {
    window.sessionStorage.setItem('username', res.data.data.username);
    window.sessionStorage.setItem('manageSite', res.data.data.siteId);
    window.sessionStorage.setItem('areaId', res.data.data.areaId);
    router.push({ path: '/Mapmoti' });
  }
}
onMounted(() => {
  let token = currentRoute.value.query.token;
  // 存储token

  window.sessionStorage.setItem('token', token);
  console.log(token);
  // console.log(token);
  // window.sessionStorage.setItem('token', currentRoute.value.query.token);
  getId(token)
})
</script>

<style scoped></style>